// JavaScript Document

$(document).ready(function () {
    var theme_url = "/App_Themes/Theme.Wap/Images";
	/*-----------------menu ben trai ----------------*/
	$('#mS').click(function(){
		var height= $(window).height();
		$(".menuhi2").css({"background":"black","width":($(window).width() -58) });
		$("#mTop .l .menu").css({ "width":($(window).width() -58) });
		$("#mnFind").css("height","48px");
		$('#mTop .r').css({"margin-top":"0"});
		$('#mTop .l .menu .r').css({"margin-top":"0"});
		$('#mTop #mnFind img').css({"padding-top":"12px"});
		$('#mTop #mnFind img').attr({"src":theme_url+"/menu_icon.png"});
		$('#mTop .l .l').css({"background":"none"});
		$('#mTop #mS').css({"display":"none"});
		$('#mTop .b').css({"display":"none"});
		$('#mTop .menu').css({"display":"block"});
		$('#mTop .l img').css({"border":"none"});
		$('#mTop .lgFrm, .b1').css({"display":"none"});
		$('#mTop .l .menu .firstRow .r .lg').removeClass('at');
		$('#mTop .l .menu .firstRow .r .rg').removeClass('at');
		$('#mTop .mn').css({"display":"block"});
		$('#mTop .rgs').css({"display":"none"});
		$('#menuBg').css({"height":height});
		$('#menuBg').fadeIn(1000);
		$('#bodyPn').css({"height":height});
		$("video").css({visibility:"hidden"});
	});
	$('#mnFind').click(function(){
	    if ($('#mTop #mnFind img').attr("src") == "/App_Themes/Theme.Wap/Images/menu_icon.png")
		{
		    $('#mTop .l').css({ "background": "url(" + "/App_Themes/Theme.Wap/Images" + "/menu_top_bg1.png) repeat-x" });
		    $('#mTop #mnFind img').attr({ "src": "/App_Themes/Theme.Wap/Images" + "/find_icon.png" });
			$(".menuhi2").css({"width":"58px"});			
			$('#mTop #mS').css({"display":"block"});
			$('#mTop .b,.b1').css({"display":"block"});
			$('#mTop .menu').css({"display":"none"});
			$('#menuBg').fadeOut(1000);
			$('#bodyPn').css({"height":"auto"});$("#mnFind").css("height","44px");
			
			$("video").css({visibility:"visible"});
			
		}else{
			/*--------------menu ben phai-----------*/
			$('.fdFrm').css({"display":"block"});
			$('#mTop .l').css({"display":"none"});
			$('#mTop .r').css({"display":"none"});
			$('#mTop .b,.b1').css({"display":"none"});	
			$(".akey1").css({ "width":eval($("body").width()-100)});
			$(".akey1").focus();
		}
	});
	
	$('.kp3').click(function(){
	    if ($('#mTop #mnFind img').attr("src") == "/App_Themes/Theme.Wap/Images/menu_icon.png")
		{
		    $('#mTop .l').css({ "background": "url(" + "/App_Themes/Theme.Wap/Images" + "/menu_top_bg1.png) repeat-x" });
		    $('#mTop #mnFind img').attr({ "src": "/App_Themes/Theme.Wap/Images" + "/find_icon.png" });
			$(".menuhi2").css({"width":"58px"});			
			$('#mTop #mS').css({"display":"block"});
			$('#mTop .b,.b1').css({"display":"block"});
			$('#mTop .menu').css({"display":"none"});
			$('#menuBg').fadeOut(1000);
			$('#bodyPn').css({"height":"auto"});$("#mnFind").css("height","44px");

			$("video").css({visibility:"visible"});
			
		}else{
			/*--------------menu ben phai-----------*/
			$('.fdFrm').css({"display":"block"});
			$('#mTop .l').css({"display":"none"});
			$('#mTop .r').css({"display":"none"});
			$('#mTop .b,.b1').css({"display":"none"});	
			
		}
	});
	/*-----------------tat textbox tim kiem tren menu----------------*/
	$('#closeFind').click(function(){
		$('.fdFrm').css({"display":"none"});
		$('#mTop .l').css({"display":"block"});
		$('#mTop .r').css({"display":"block"});
		$('#mTop .b,.b1').css({"display":"block"});	
	});
	
	/*---------------------mo form dang nhap-------------------*/
	$('#mTop .l .menu .firstRow .r .lg').click(function(){
		if($('#mTop .lgFrm').css("display")=="none"){
			$('#mTop #mnBottom').children().css({"display":"none"});
			$('#mTop .l .menu .firstRow .r .rg').removeClass('at');
			$("#mnFind").css("height","48px");
			$(this).addClass('at');
			$('#mTop .lgFrm').css({"display":"block"});
			//$('#mTop .rgs').css({"display":"none"});
		}else{
			$(this).removeClass('at');
			$('#mTop #mnBottom').children().css({"display":"none"});
			$('#mTop .mn').css({"display":"block"});
		}
	});
	
	/*---------------------mo form dang ky---------------------*/
	$('#mTop .l .menu .firstRow .r .rg, .registerher1').click(function () {
		if($('#mTop .rgs').css("display")=="none"){
			$("#mnFind").css("height","48px");
			$('#mTop #mnBottom').children().css({"display":"none"});
			$('#mTop .l .menu .firstRow .r .lg').removeClass('at');
			$(this).addClass('at');
			$('#mTop .rgs').css({"display":"block"});
		}else{
			$(this).removeClass('at');
			$('#mTop #mnBottom').children().css({"display":"none"});
			$('#mTop .mn').css({"display":"block"});
		}
	});
	
	/*--------------- click vao input, mat text --------------*/
	/*-- an --*/
	$(".menu input[type='text']").focusin(function(){
		$(this).prev('.lgTxt').css({"display":"none"});											 
	});
	$(".menu input[type='password']").focusin(function(){
		$(this).prev('.lgTxt').css({"display":"none"});											 
	});
	$('.lgTxt').click(function(){
		$(this).css({"display":"none"});											 
	});
	
	/*-- hien --*/
	$(".menu input[type='text']").focusout(function(){
		var x= $(".menu input[type='text']").val().length;
		if(x<1){
			$(this).prev('.lgTxt').css({"display":"block"});
		}
	});
	
	$(".menu input[type='password']").focusout(function(){
		var x= $(".menu input[type='text']").val().length;
		if(x<1){
			$(this).prev('.lgTxt').css({"display":"block"});
		}
	});
	/*---------------------------- len dau trang --------------------------*/
	$('#footer .arrTop').click(function(){
		$('html, body').animate({ scrollTop: 0 }, 'slow');
	});
	
	
});